﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace BaoJian.member.exchange
{
    public partial class Transacting : System.Web.UI.Page
    {
        private string UserID = HttpContext.Current.User.Identity.Name;
        private  LYQ.BLL.ExchangeProduct bll = new LYQ.BLL.ExchangeProduct();
    
        protected void Page_Load(object sender, EventArgs e)
        { 
            if (!Page.IsPostBack)
            {
                Tools.Common.IsAuthenticated();
                BindData();
            }
        }
        private void BindData()
        {

            string where = "[CustomerID]='{0}' and ([Publish]='已登记' OR [Publish]='审核中') order by OrderID desc";
            where = string.Format(where,UserID);
            DataSet ds = bll.GetList(where);
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            BindData();
        }

        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int id = Int32.Parse(this.GridView1.DataKeys[e.RowIndex].Value.ToString());
            bll.Delete(id);
            BindData(); 
        }
    }

}
